package com.sx.entity.user;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.sx.basic.BasicEntity;
import com.sx.basic.serializer.LongToStringSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import javax.persistence.*;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;

/**
 * @author AdinZ
 * @date 2020/11/18 13:57
 */
@Data
@TableName(value = "sx_user_relation")
@Entity
@Table(name = "sx_user_relation")
@ApiModel(value = "用户邀请码",description = "用户邀请码")
public class RelationEntity extends BasicEntity {

    public static final String KEY="RelationEntity";


    @Id
    @GeneratedValue
    @TableId(type = IdType.ASSIGN_ID)
    private Long id;

    @ApiModelProperty("邀请人id")
    @JSONField(serializeUsing = LongToStringSerializer.class)
    private long inviteUid;

    @ApiModelProperty("用户id")
    @JSONField(serializeUsing = LongToStringSerializer.class)
    private long uid;

    @ApiModelProperty("层级")
    private int level;

    @ApiModelProperty("创建时间")
    private long created=System.currentTimeMillis();


    public RelationEntity(){}

    public RelationEntity(long inviteUid, long uid, int level) {
        this.inviteUid = inviteUid;
        this.uid = uid;
        this.level = level;
    }



}
